package com.jihu.design.creatation.prototype;

/**
 * 原型模式
 * 是用于创建重复的对象，同事又能保证性能
 * @author jihu
 * @date 2021/9/13
 */
public class MainTest {

    public static void main(String[] args) throws CloneNotSupportedException {
        Mybatis mybatis = new Mybatis();
        User zhangsan1 = mybatis.getUser("张三");
        System.out.println("1-->"+zhangsan1);
        zhangsan1.setUsername("李四2");
        System.out.println("zhangsan1自己改了:"+zhangsan1);

        User zhangsan2 = mybatis.getUser("张三");
        System.out.println("2-->"+zhangsan2);

        User zhangsan3 = mybatis.getUser("张三");
        System.out.println("3-->"+zhangsan3);

        User zhangsan4 = mybatis.getUser("张三");
        System.out.println("4-->"+zhangsan4);

        User zhangsan5 = mybatis.getUser("张三");
        System.out.println("5-->"+zhangsan5);

    }
}
